<?php
// post new topic (user interface)
//
// digiboard by digitalboom.org
// http://www.digitalboom.org
//
// Information Technology program
// Sirindhorn International Institute of Technology
// Thammasat University, Rangsit Campus
// http://www.siit.tu.ac.th
//
// first created on: 2001 Jun xx
// modified by bact'
// last modified on: 2008 Jul 13 by sea

include("settings/config.inc.php");
include("settings/accounts.inc.php");
include("settings/forum.inc.php");
include("lib/util.inc.php");
include("lib/users_function.inc.php");

extract($_POST);
extract($_GET);

function post_forum_selector($forum=2) {
 global $DGB, $DGB_FORUM, $DGB_FORUM_NAME, $DGB_FORUM_PUBLIC;

 $html = "<select class=\"rfc\" name=\"forum_id\">\n";
 if ($forum < 1) {
   $forum = $DGB["FORUM_DEFAULT_POST"];;
 }

 for ($i = 1; $i <= $DGB_FORUM['NUMBER']; $i++) {
  if ($i == $forum)
   $html .= "<option value=\"$i\" selected>".$DGB_FORUM_NAME[$i];
  else
   $html .= "<option value=\"$i\">".$DGB_FORUM_NAME[$i];

  if ($DGB_FORUM_PUBLIC[$i] == 0) 
   $html .= " *";

  $html .= "</option>\n";
 }
 $html .= "</select>\n";

 return $html;
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$DGB["ENCODING"];?>">
<title>post new</title>
<link rel="stylesheet" href="<?=$DGB["STYLESHEET"];?>" type="text/css">
<script language="JavaScript">
<!--

var remote=null;
function nw(n,u,w,h,x) {
 args="width="+w+",height="+h+",resizable=yes,scrollbars=yes,status=0";
 n = n+"postnew";
 remote=window.open(u,n,args);
 if (remote != null) {
  if (remote.opener == null)
   remote.opener = self;
 }
 if (x == 1) { return remote; }
}

function put(m) {
 s = document.compose.msgdetail.value;
 document.compose.msgdetail.value = s + m;
}

//-->
</script>
</head>

<body bgcolor="#FFFFEE">

<table class="pHead" width="100%" border=0 cellspacing=0 cellpadding=0>
 <tr valign="middle">
  <td>
   <b><font color="#FFFFFF"><?=$DGB["WEBBOARD_NAME"];?></font> / post new</b>
  </td>
 </tr>
</table>

<table class="pSubHead" width="100%" border=0 cellspacing=0 cellpadding=0>
 <tr>
  <td valign="middle" class="pagesubheader" align="right"><?=$DGB["WEBBOARD_DESCRIPTION"];?> </td>
 </tr>
</table>
<!--END HEADER-->

<!--START POST FORM-->
<br>
<form name="compose" method="post" action="post.php">
<table width="80%" border=0 align="center" cellpadding=1 cellspacing=0 bgcolor="#cccccc">
<tr bgcolor="#999999">
 <td><img src="images/i_balloon.gif" width=15 height=13> <font color="#ffffff"><b>post new message</b></font></td>
</tr>
<tr>
<td>
<table width="100%" border=0 align="center" bgcolor="#fefefe">
<tr>
<td>
<table class="rf" border=0 align="center">
 <tr valign="top">  <td>forum:</td>
  <td>
   <?=post_forum_selector($forum);?>
  </td>
  <td>
   <font color="#666666" size="-2">* = private forum,<br>not show in 'general' topic list</font>
  </td>
 </tr>
 <tr valign="top">
  <td>topic:</td>
  <td colspan="2"><input class="rfc" size="40" type="text" name="msgname"></td>
 </tr>
 <tr valign="top">
   <td>&nbsp;</td>
   <td colspan="2"><a href="javascript:put('[b][/b]')"><img src="images/bold.gif" alt="Bold" width="16" height="16" border="0"></a> <a href="javascript:put('[i][/i]')"><img src="images/italics.gif" alt="Italics" width="16" height="16" border="0"></a> <a href="javascript:put('[u][/u]')"><img src="images/underline.gif" alt="Underline" width="16" height="16" border="0"> </a><a href="javascript:put('[sup][/sup]')"><img src="images/sup_script.gif" alt="Superscript" width="16" height="16" border="0"></a> <a href="javascript:put('[sub][/sub]')"><img src="images/sub_script.gif" alt="Subscript" width="16" height="16" border="0"></a> <a href="javascript:put('[quote][/quote]')"><img src="images/quote.gif" width="16" height="16" border="0"></a> <a href="javascript:nw('smilies','smilies/smilies.html',330,300,0)"><img src="images/smiley.gif" alt="Smiley" width="16" height="16" border="0"></a> <a href="javascript:put('[www][/www]')"><img src="images/links.gif" alt="Links" width="16" height="16" border="0"> </a>
   <?php if ($DGB["ENABLE_UPLOAD"] == true) 
   { echo "<a href=\"javascript:nw('upload','upload_ui.php?Topic_ID=0000',350,250,0)\" title=\"upload pictures, photos\"><img src=\"images/i_upload.gif\" width=19 height=19 border=0 align=\"middle\"></a>" ;
   }
   ?>  
    <a href="javascript:put('[mail][/mail]')"><img src="images/email.gif" alt="e-mail" width="16" height="16" border="0"></a></td>
 </tr>
 <tr valign="top">
  <td nowrap>text:<hr width="98%">
   <font color="#666666"><font size="-2">toolbox</font><br>
   <a class="textTool" href="javascript:nw('smilies','smilies/smilies.html',330,300,0)" title="smilies, emoticons and extra icons"><img src="images/i_smilies.gif" width=19 height=19 border=0 align="middle"> smilies</a><br>
   <a class="textTool" href="javascript:nw('deco','html/textdeco.html',400,300,0)" title="text decoration, making links to web, e-mail and picture"><img src="images/i_textdeco.gif" width=19 height=19 border=0 align="middle"> deco</a>
   <?php
   if ($DGB["ENABLE_UPLOAD"] == true) {
    echo "<br><a class=\"textTool\" href=\"javascript:nw('upload','upload_ui.php?Topic_ID=0000',350,250,0)\" title=\"upload pictures, photos\"><img src=\"images/i_upload.gif\" width=19 height=19 border=0 align=\"middle\"> upload</a>";
   }
   ?> 
   
   </font>
  </td>
  <td colspan=2><textarea class="rfc" name="msgdetail" cols=40 rows=6 wrap="VIRTUAL"></textarea></td>
 </tr>

 <?php
  if ($DGB["ENABLE_LOGIN"] == true) {
   global $DGB, $db_link;
   $UserDetail = SelectUserDetail($_COOKIE[Username],$_COOKIE[Password],$db_link,$DGB['DB_USERS_TABLE']);
   list($Email,$ICQ,$MSN)= explode("|",$UserDetail);
  }
 ?>
 <tr>
  <td>verify :</td>
  <td colspan=2>
   <img src="captcha/imagebuilder.php" border="1"><br>
   Please enter the code shown above.<br>
   <input class="rfc" MAXLENGTH=8 SIZE=8 name="userstring" type="text" value=""><br> 
  </td>
 </tr>
 <tr valign="top">
  <td>from:</td>
  <td colspan="2"><input class="rfc" size="25" type="text" name="msgby"
   <?if($DGB["ENABLE_LOGIN"]) { if(!empty($_COOKIE[Username])){echo "value = '$_COOKIE[Username]'";} }?>></td>
 </tr>
 <tr class="rf_opt" valign="top">
  <td>email:</td>
  <td colspan="2"><input class="rfc_opt" size="25" type="text" name="email"
   <?if($DGB["ENABLE_LOGIN"]) { if(!empty($Email)){echo "value = '$Email'";}}?>> <font size="1">(optional)</td>
 </tr>
 <tr class="rf_opt" valign="top">
  <td>icq:</td>
  <td colspan="2"><input class="rfc_opt" size="25" type="text" name="icq"
   <?if($DGB["ENABLE_LOGIN"]) { if(!empty($ICQ)){echo "value = '$ICQ'";}}?>> <font size="1">(optional)</td>
 </tr>
 <tr>
  <td>�</td>
  <td colspan=2>
   <input class="rfc_btn" type="submit" value="�post message�" name="submit"> 
   <input class="rfc_btn" type="reset" value="�clear all�" name="reset">
  </td>
 </tr>
 <tr class="rf_opt">
  <td colspan=3 align="center">hit 'post message' only once</td>
 </tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<!--END POST FORM-->

<?php
include("html/footer.html");
?>
</body>
</html>
